package com.net.common.util;

import com.google.common.base.Strings;

/**
 * @author  on 2017/6/27.
 * 返回图片的格式后缀
 */
public class ImageUtil {
    public static String getImageSuffix(String name) {
        if (Strings.isNullOrEmpty(name)) {
            return "";
        }
        name = name.toLowerCase();
        if (name.endsWith(".jpg") || name.endsWith(".jpeg")) {
            return "jpg";
        } else if (name.endsWith(".png")) {
            return "png";
        } else if (name.endsWith("gif")) {
            return "gif";
        } else {
            return "";
        }
    }
}
